package com.bionic.banking.core.entity;

import java.io.Serializable;

public class Address implements Serializable {

    private Integer addressId;
    private String line1;
    private String line2;
    private String city;
    private String region;
    private String country;
    private String postalCode;
    private String street;

    public Address() {
    }

    public Address(String postalCode, String country, String region, String city, String street, String line1, String line2) {
        this.country = country;
        this.region = region;
        this.postalCode = postalCode;
        this.city = city;
        this.street = street;
        this.line1 = line1;
        this.line2 = line2;
    }

    public Integer getAddressId() {
        return addressId;
    }

    public void setAddressId(Integer addressId) {
        this.addressId = addressId;
    }

    public String getLine1() {
        return line1;
    }

    public void setLine1(String line1) {
        this.line1 = line1;
    }

    public String getLine2() {
        return line2;
    }

    public void setLine2(String line2) {
        this.line2 = line2;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (addressId != null ? addressId.hashCode() : 0);

        final int multiplier = 23;
        if (hash == 0) {
            int code = 133;
            code = multiplier * code + postalCode.hashCode();
            code = multiplier * code + country.hashCode();
            code = multiplier * code + region.hashCode();
            code = multiplier * code + city.hashCode();
            code = multiplier * code + street.hashCode();
            code = multiplier * code + line1.hashCode();
            code = multiplier * code + line2.hashCode();
            hash = code;
        }
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Address)) {
            return false;
        }

        Address other = (Address) object;

        if ((this.getCity() == null ? other.getCity() == null
                : this.getCity().equals(other.getCity()))
                && (this.getCountry() == null ? other.getCountry() == null
                : this.getCountry().equals(other.getCountry()))
                && (this.getPostalCode() == null ? other.getPostalCode() == null
                : this.getPostalCode().equals(other.getPostalCode()))
                && (this.getRegion() == null ? other.getRegion() == null
                : this.getRegion().equals(other.getRegion()))
                && (this.getCity() == null ? other.getCity() == null
                : this.getCity().equals(other.getCity()))
                && (this.getStreet() == null ? other.getStreet() == null
                : this.getStreet().equals(other.getStreet()))
                && (this.getLine1() == null ? other.getLine1() == null
                : this.getLine1().equals(other.getLine1()))
                && (this.getLine2() == null ? other.getLine2() == null
                : this.getLine2().equals(other.getLine2()))) {
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return "[" + postalCode + "], country: " + country
                + ", region: " + region
                + ", city: " + city
                + ", str. " + street
                + ", line1: " + line1 + ", line 2 " + line2;
    }
}
